/*
 * Copyright (c) GoKeep by gokeep.org. 2022-2023. All rights reserved
 */
package org.gokeep.application.rest;

import jakarta.annotation.Resource;
//import org.gokeep.common.util.UserContext;
import org.gokeep.common.dto.FriendDto;
import org.gokeep.common.util.UserContext;
import org.gokeep.communication.service.UserService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/relation")
public class RelationApi {

    @Resource
    private UserService userService;

    /**
     * 获取我的好友列表
     *
     * @return FriendDto
     */
    @GetMapping("/friends")
    public FriendDto getUserFriends() {
        String userId = UserContext.getUserId();
        return userService.getUserFriends(userId);
    }

    /**
     * 获取群组成员列表
     *
     * @return FriendDto
     */
    @GetMapping("/group/{groupId}/users")
    public FriendDto getGroupMember(@PathVariable String groupId) {
        return userService.getGroupMemberUser(groupId);
    }
}
